# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Victor Martinez Romanos <vmromanos@gmail.com>

pkgname=toolame
pkgver=02l
pkgrel=14
pkgdesc="An optimized mpeg 1/2 layer 2 audio encoder"
arch=('loong64' 'x86_64')
url="https://sourceforge.net/projects/toolame"
license=('LGPL')
depends=('glibc')
source=(https://downloads.sourceforge.net/sourceforge/toolame/toolame-02l.tgz
        toolame-02l-fno-common.patch
        toolame-02l-Makefile.patch
        toolame-02l-uint32_t.patch
        toolame-02l-uint.patch)
sha256sums=('3b95cd2504bceac4aab2fca03bb3b5974d1d44b5afdd8eb4cc0f0899521bffc4'
            '1e447b4471e39cb8d238686cab45ba1afa7ef52ce4846f9f09a9f6ffa3c6ffd4'
            'f99d95a2a10ba15ed4205277e018adab6d1f42d4bcfa4d5543a9bf067180beb9'
            'e76d347149cb0df2b75d65c448070b04c9f9e7c876d4b54131ef8deeb2ec23cb'
            'd45a1564663337b0f7b50120f3491542b9ceaf6a003b73d786f9f41f01d78dfa')

prepare() {
  cd "$srcdir"/$pkgname-$pkgver
  patch -Np1 -i ../toolame-02l-fno-common.patch
  patch -Np1 -i ../toolame-02l-Makefile.patch
  patch -Np1 -i ../toolame-02l-uint32_t.patch
  patch -Np1 -i ../toolame-02l-uint.patch

}

build() {
  cd "$srcdir"/$pkgname-$pkgver
  make
}

package() {
  cd "$srcdir"/$pkgname-$pkgver
  install -D -m755 toolame "$pkgdir"/usr/bin/toolame
}
